#ifndef MYGRAPH_H_INCLUDED
#define MYGRAPH_H_INCLUDED

#include <iostream>
#include <string>
using namespace std;

class EdgeNode{ 
private:
    int dest; //目标节点
    EdgeNode* link; //指向下一条边节点的指针

public:
    EdgeNode();
    EdgeNode(int, EdgeNode*);
    ~EdgeNode();
    int getDest();
    EdgeNode* getNext();
    void setDest(int);
    void setNext(EdgeNode*);
};

class VertexNode{ 
private:
    char data; 
    EdgeNode* firstEdge;

public:
    VertexNode();
    VertexNode(char, EdgeNode*);
    ~VertexNode();
    char getData();
    EdgeNode* getFirstEdge();
    void setData(char);
    void setFirstEdge(EdgeNode*);
};

class MyGraph{ 
private:
    int nodeNum; 
    int edgeNum; 
    VertexNode* VexList; 

public:
    MyGraph();
    MyGraph(int, int, char*, int*, int*);
    ~MyGraph();
    int getNodeNum();
    int getEdgeNum();
    string printGraph(); 

    
    void DFS(int, int*, string&);
    void BFS(int, int*, string&);
    int getFirstNeighbor(int, int*);
    int getNextNeighbor(int, int, int*);

    // DFS
    string graph_BFS_Traverse();
    string graph_DFS_Traverse();
};


#endif 
